<include file="../header" />
<body class="J_scroll_fixed">
<script type="text/javascript" src="__ROOT__/statics/js/ajaxfileupload.js"></script>
<script type="text/javascript" src="__ROOT__/statics/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__ROOT__/statics/js/ueditor/ueditor.all.min.js"></script>

<script type="text/javascript">
    $(function () {

        $("button#upload").click(function(){
            //上传文件
            $.ajaxFileUpload({
                url:"{:U('guide/uploadImage')}",//处理图片脚本
                secureuri :false,
                fileElementId :'fileToUpload',//file控件id
                dataType : 'json',
                success : function (data, status){
                    $("input[name=iconPath]").val(data);
                    $("img[name=preImage]").attr("src", data);
                },
                error: function(data, status, e){
                    alert(e);
                }
            })
        });

    });
</script>
<div class="wrap jj">
    <ul class="nav nav-tabs">
        <li><a href="{:U('guide/index')}">导航列表</a></li>
        <li class="active">更新导航</li>
    </ul>

    <div class="common-form">
        <form  id='add' method="post" class="form-horizontal J_ajaxForm" action="{:U('guide/editPost')}">
            <input name="guideId" type="hidden" value="{$info.guide_id}" />
            <fieldset>
                <div class="control-group">
                    <label class="control-label">名称：</label>
                    <div class="controls">
                        <input type="text" name="name" value="{$info.name}" />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">目标链接：</label>
                    <div class="controls">
                        <input type="text" name="targetUrl" value="{$info.target_url}" />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">图标预览</label>
                    <div class="controls">
                        <img src="{$info.icon_path}" name="preImage" style="width:224px;height:168.5px;" />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">上传图标</label>
                    <div class="controls">
                        <input id="fileToUpload" type="file" name="fileToUpload" style="width:170px;">
                        <button class="btn" type="button" id="upload">上传</button>
                        <input type="hidden" name="iconPath" value="{$info.icon_path}" />
                    </div>
                </div>
            </fieldset>

            <div class="form-actions">
                <button id='send' type="submit" class="btn btn-primary">更新</button>
                <a class="btn" href="__URL__">返回</a>
            </div>
        </form>
    </div>
</div>
<script src="__ROOT__/statics/js/common.js"></script>
</body>
</html>